//
//  HRChatAdminCell.m
//  Hear
//
//  Created by mac on 2018/1/24.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "HRChatAdminCell.h"
@interface HRChatAdminCell()
{
    EMMessageBodyType _messageType;
}
@property (strong, nonatomic) UIImageView *avatarView;
@property (strong, nonatomic) UIImageView *showIconView;
@property (strong, nonatomic) UIView *soundCardView;
@property (strong, nonatomic) UILabel *nickNameLabel;
@property (strong, nonatomic) UIButton *sexButton;
@property (strong, nonatomic) UILabel *distanceLabel;
@property (strong, nonatomic) UIButton *label1Button;
@property (strong, nonatomic) UIButton *label2Button;
@property (strong, nonatomic) UIButton *label3Button;

@property (strong, nonatomic) UILabel *problemRemendLabel;
@property (strong, nonatomic) UILabel *problemLabel;

@end
@implementation HRChatAdminCell

+ (void)initialize{
    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier model:(id<IMessageModel>)model
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _messageType = model.bodyType;
        [self _setupSubviewsWithType:_messageType
                            isSender:model.isSender
                               model:model];
        
    }
    
    return self;
}

- (void)_setupSubviewsWithType:(EMMessageBodyType)messageType
                      isSender:(BOOL)isSender
                         model:(id<IMessageModel>)model{
    CGFloat pading = 10;
    
    _avatarView = [[UIImageView alloc] init];
    _avatarView.backgroundColor = [UIColor clearColor];
    _avatarView.clipsToBounds = YES;
    _avatarView.userInteractionEnabled = YES;
    [self.contentView addSubview:_avatarView];
    _avatarView.layer.cornerRadius = 20;
    _avatarView.clipsToBounds = YES;
    
    UIView *soundCardView = [UIView new];
    soundCardView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:(self.soundCardView=soundCardView)];
    
    _showIconView = [[UIImageView alloc] init];
    _showIconView.backgroundColor = [UIColor clearColor];
    _showIconView.clipsToBounds = YES;
    _showIconView.userInteractionEnabled = YES;
    [soundCardView addSubview:_showIconView];
    _showIconView.layer.cornerRadius = 20;
    _showIconView.clipsToBounds = YES;
    
    self.nickNameLabel = [UILabel new];
    self.nickNameLabel.font = CustomUIFont(13);
    self.nickNameLabel.textColor = FirstTextColor;
    [self.soundCardView  addSubview:self.nickNameLabel];
    self.nickNameLabel.text = @"说说你坚持最久的一件事";
    
    
    self.sexButton = [UIButton buttonWithType:0];
    self.sexButton.layer.borderColor = BlueColor.CGColor;
    self.sexButton.layer.borderWidth = 1;
    self.sexButton.layer.cornerRadius = 3;
    self.sexButton.clipsToBounds = YES;
    [_soundCardView addSubview:self.sexButton];
    self.sexButton.titleLabel.font = CustomUIFont(12);
    
    
    self.distanceLabel = [UILabel new];
    self.distanceLabel.font = CustomUIFont(13);
    self.distanceLabel.textColor = FirstTextColor;
    [self.soundCardView addSubview:self.distanceLabel];
    self.distanceLabel.text = @"1.6km";
    
    
    self.label1Button = [UIButton buttonWithType:0];
    self.label1Button.layer.borderColor = BlueColor.CGColor;
    self.label1Button.layer.borderWidth = 1;
    self.label1Button.layer.cornerRadius = 3;
    self.label1Button.clipsToBounds = YES;
    [_soundCardView addSubview:self.label1Button];
    self.label1Button.titleLabel.font = CustomUIFont(12);
    [self.label1Button setTitleColor:BlueColor forState:0];
    
    self.label2Button = [UIButton buttonWithType:0];
    self.label2Button.layer.borderColor = BlueColor.CGColor;
    self.label2Button.layer.borderWidth = 1;
    self.label2Button.layer.cornerRadius = 3;
    self.label2Button.clipsToBounds = YES;
    [_soundCardView addSubview:self.label2Button];
    self.label2Button.titleLabel.font = CustomUIFont(12);
    [self.label2Button setTitleColor:BlueColor forState:0];
    
    self.label3Button = [UIButton buttonWithType:0];
    self.label3Button.layer.borderColor = BlueColor.CGColor;
    self.label3Button.layer.borderWidth = 1;
    self.label3Button.layer.cornerRadius = 3;
    self.label3Button.clipsToBounds = YES;
    [_soundCardView addSubview:self.label3Button];
    self.label3Button.titleLabel.font = CustomUIFont(12);
    [self.label3Button setTitleColor:BlueColor forState:0];
    
    self.problemRemendLabel = [UILabel new];
    self.problemRemendLabel.font = CustomUIFont(13);
    self.problemRemendLabel.textColor = BlueColor;
    [self.soundCardView addSubview:self.problemRemendLabel];
//    self.problemRemendLabel.text = @"你们共同回答过的话题：";
    
    self.problemLabel = [UILabel new];
    self.problemLabel.font = CustomUIFont(13);
    self.problemLabel.textColor = FirstTextColor;
    [self.soundCardView addSubview:self.problemLabel];
//    self.problemLabel.text = @"你们共同回答过的话题你们共同回答过的话题你们共同回答过的话题你们共同回答过的话题你们共同回答过的话题你们共同回答过的话题";
    self.problemLabel.numberOfLines = 2;
    
    
}
+ (NSString *)cellIdentifier
{
    return @"HRChatAdminCell";
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
